﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:pb="clr-namespace:Spritehand.PhysicsBehaviors;assembly=Spritehand.PhysicsBehaviors" x:Class="ShuffleBoard.ucPuck"
    mc:Ignorable="d"
   Width="80" Height="60" >
    <UserControl.Resources>
        <Storyboard x:Name="sbLostPuck">
            <DoubleAnimation Duration="0:0:0.4" To="29.266" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="cnvInner" d:IsOptimized="True"/>
            <DoubleAnimation Duration="0:0:0.4" To="0.7" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="cnvInner" d:IsOptimized="True"/>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="cnvInner">
                <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0.99"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>

    <Canvas x:Name="LayoutRoot" Height="60" Width="80" >
        <Canvas x:Name="Puck" Height="60" Width="80" RenderTransformOrigin="0.5,0.5" CacheMode="BitmapCache">
            <Canvas.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </Canvas.RenderTransform>
            <i:Interaction.Behaviors>
                <pb:PhysicsObjectBehavior MomentOfIntertia="1E+28" RestitutionCoefficient="1" Mass="0.1"/>
            </i:Interaction.Behaviors>
            <Canvas x:Name="cnvInner" Height="27" Width="39" RenderTransformOrigin="0.5,0.5">
                <Canvas.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Canvas.RenderTransform>
                <Path x:Name="pathPuckBottom" Stretch="Fill" Stroke="#FF8C8C8C" Height="40" Width="78.25" UseLayoutRounding="False" Canvas.Top="7.67" Data="M118,0.5 C141.32109,0.49999934 163.05531,4.1139121 181.33131,10.346326 L181.77023,10.499998 L232.52692,25.454405 L232.79463,62.613415 C231.18605,96.385681 183.54634,117.33334 119.66685,117.33334 C54.773384,117.33334 3.0000207,94.517799 3.0000207,60 C3.0000207,58.381981 7.9367394,17.965088 7.9367394,17.965088 L54.229771,10.499998 L54.668694,10.346326 C72.944687,4.1139121 94.678909,0.49999934 118,0.5 z" Canvas.Left="0.84">
                    <Path.Fill>
                        <LinearGradientBrush EndPoint="0.725,0.766" StartPoint="0.275,0.234">
                            <GradientStop Color="#FFA9E0EC"/>
                            <GradientStop Color="#FF99C2CB" Offset="1"/>
                            <GradientStop Color="White" Offset="0.5"/>
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
                <Ellipse x:Name="ellipsePuckUp" Stroke="#FF8C8C8C" Height="40" Width="80">
                    <Ellipse.Fill>
                        <RadialGradientBrush Center="0.671,0.637" GradientOrigin="0.671,0.637" RadiusX="0.33" RadiusY="0.265">
                            <RadialGradientBrush.RelativeTransform>
                                <TransformGroup>
                                    <ScaleTransform CenterX="0.69700002670288086" CenterY="0.57099997997283936"/>
                                    <SkewTransform AngleX="0" AngleY="0" CenterX="0.69700002670288086" CenterY="0.57099997997283936"/>
                                    <RotateTransform Angle="-44.913" CenterX="0.69700002670288086" CenterY="0.57099997997283936"/>
                                    <TranslateTransform X="0"/>
                                </TransformGroup>
                            </RadialGradientBrush.RelativeTransform>
                            <GradientStop x:Name="colorHighlight" Color="#FFBCC2CD" Offset="0"/>
                            <GradientStop x:Name="colorMain" Color="#FF2853AB" Offset="1"/>
                        </RadialGradientBrush>
                    </Ellipse.Fill>
                </Ellipse>
                <Ellipse x:Name="ellipsePuckMid" Stroke="#FF8C8C8C" Height="16" Width="30" Canvas.Left="25" Canvas.Top="9">
                    <Ellipse.Fill>
                        <RadialGradientBrush>
                            <GradientStop Color="White"/>
                            <GradientStop Color="#FF99C2CB" Offset="1"/>
                        </RadialGradientBrush>
                    </Ellipse.Fill>
                </Ellipse>
            </Canvas>
        </Canvas>
    </Canvas>
</UserControl>
